//
//  RepairDetailVC.m
//  QoilPublic
//
//  Created by SunChao on 2018/4/19.
//  Copyright © 2018年 孙超. All rights reserved.
//

#import "RepairDetailVC.h"
#import "InstructionsCell.h"
@interface RepairDetailVC ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong)UITableView *tbView;

@end

@implementation RepairDetailVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self.view addSubview:self.tbView];
    self.tbView.frame = CGRectMake(0, 0, kScreenWidth, kScreenHeight);
    self.tbView.tableFooterView = [[UIView alloc]initWithFrame:CGRectZero];
    [self.tbView registerNib:[UINib nibWithNibName:@"InstructionsCell" bundle:nil] forCellReuseIdentifier:@"InstructionsCell"];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return 3;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    if (indexPath.row == 0) {
        return  60;
    }
    if (indexPath.row == 1) {
        return 35;
    }
    return 50;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
     InstructionsCell *cell = [tableView dequeueReusableCellWithIdentifier:@"InstructionsCell"];
    cell.bokenLabel.hidden = NO;
    if (indexPath.row == 0) {
        cell.userInteractionEnabled = NO;
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.device.text = @"时间";
        cell.bokenLabel.text = @"故障";
        cell.repairMoney.text = @"费用";
        return cell;
    }
    cell.device.text = @"3月8日";
    cell.bokenLabel.text = @"水箱";
    cell.repairMoney.text = @"100元";
    [cell setCellWithData:nil];
    return cell;
    
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    NSLog(@"indexPaht:%ld",indexPath.row);
    RepairDetailVC *vc = [[RepairDetailVC alloc]init];
    vc.title = @"斗山210";
    [self.navigationController pushViewController:vc animated:YES];
    
}

-(UITableView *)tbView{
    
    if (!_tbView) {
        _tbView = [[UITableView alloc]initWithFrame:CGRectZero style:UITableViewStylePlain];
        _tbView.delegate = self;
        _tbView.dataSource = self;
        _tbView.backgroundColor = [UIColor groupTableViewBackgroundColor];
        
    }
    return _tbView;
    
}

@end
